package days48;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.Scanner;
class Node{
    int  val;
    Node next;

    public Node(int val) {
        this.val = val;
    }
}

public class Day28 {

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n= scanner.nextInt();
        Node head = null;
        Node cur= null;
        for (int i = 0; i <= n; i++) {
            if(head == null){
                head =new Node(-1);
                cur=head;
                continue;
            }
            cur.next=new Node(scanner.nextInt());
            cur=cur.next;
        }
        int l=scanner.nextInt();
        int r=scanner.nextInt();
        Node pre=head;
        for (int i = 0; i < l-1; i++) {
            pre=pre.next;
        }
        Node mid=pre.next;
        for (int i = 0; i < r-l; i++) {
            Node cur1=mid.next;
            mid.next=cur1.next;
            cur1.next=pre.next;
            pre.next=cur1;
        }
        head=head.next;
        while (head!=null){
            System.out.print(head.val+" ");
            head=head.next;
        }
    }
}
